function onLoad() {
    require(["html-header", "pointBackground"]);
    initUpload();
}

function initUpload() {
    let fileUpdater = $("#fileUpdater");
    let status = fileUpdater.find(".status");
    fileUpdater.find("button").on("click", () => {
        let fdata = new FormData();
        fdata.append("file", fileUpdater.find("input")[0].files[0]);

        function onMessage(xml, message, object) {
            status.text(message + xml.responseText);
        }
        $.ajax({
            type: "POST",
            url: fileUpdater.attr("action"),
            data: fdata,
            async: true,
            processData: false,
            contentType: false,
            error: onMessage,
            success: (data) => {
                status.text(data)
            },
        });
        return false;
    });
}
